package com.hoshiicloud.lessee.controller.homepage;

import com.hoshiicloud.common.rpc.Response;
import com.hoshiicloud.lessee.service.CompanyHomePageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * 店铺首页
 * @author linjx on 2019/8/30
 */
@RestController
@Api(value = "租户首页-租户首页订单数据统计",tags = {"租户首页-租户首页订单数据统计"})
@RequestMapping("/home-page/company-home-page")
public class LesseeHomePageController {

    @Autowired
    private CompanyHomePageService companyHomePageService;

    @ApiOperation("获取店铺首页顶部信息")
    @GetMapping("/listPlatByCompanyId")
    public Response listPlatByCompanyId(HttpServletRequest request) {
        return Response.data("");
    }


    @ApiOperation("交易总览")
    @GetMapping("/transactionsView/{aheadDays}/{platformId}")
    public Response transactionsView(@PathVariable("aheadDays") Integer aheadDays, @PathVariable("platformId") Long platformId) {
        return Response.data(companyHomePageService.transactionsView(aheadDays,  platformId));
    }

    @ApiOperation("交易趋势")
    @GetMapping("/trendChart/{aheadDays}/{platformId}")
    public Response orderPayRate(@PathVariable("aheadDays") Integer aheadDays, @PathVariable("platformId") Long platformId) {
        return Response.data(companyHomePageService.trendChart(aheadDays, platformId));
    }
}
